<style>
/* 重写样式 */
.fui-header.block {
    display: block;
}

.fui-tab {
    margin: 0;
}

.fui-tab a {
    height: 2.2rem;
    line-height: 2.2rem;
}

.fui-tab:after {
    display: none;
}
.nickname {
    color: #50b6fe;
}
    .shop-index-page .menu {height: auto; background: #fff;}
    .shop-index-page .menu .item {height: auto; width: 1%; padding: 0.5rem 0; margin: 0; font-size: 0.65rem; color: #636363; text-align: center; display: table-cell;position: relative;}
    .shop-index-page .menu .item:after  {font-size: 0.65rem;position: absolute;content: '';left:0;top:0.5rem;bottom:0.5rem;border-left:1px solid #d9d9d9;}
    .content-empty{padding:1rem 0;margin:0;}
	.section {margin:10px;padding:15px 25px;border:0.8px solid #B22222;height:120px;border-radius:5px;font-size:12px;color:#B22222}
</style>

<div class="fui-page shop-index-page" style="display:block;">
	<!-- 关注按钮 -->
	<div class="fe-guide" ng-if="pagedata.isfollow==0" style="display:block;z-index:890;">
		<div class="fe-guide-faceimg"><img ng-src="{{tomedia(pagedata.pluginset.logo) || '../core/resource/images/nopic.jpg'}}" /></div>
		<div class="fe-guide-sub" onclick="$('#followbar').modal();">立即关注</div>
		<div class="fe-guide-text">
			<p class="">{{pagedata.pluginset.followtitle ||'加关注,更多权限！'}}</br>{{pagedata.pluginset.followdesc ||'关注公众号，享专属服务'}}</p>
		</div>
	</div>
	<div id="followbar" class="modal fade" tabindex="-1" style="z-index:99999;display:none;position: absolute">
		<div class="modal-dialog" style="width:80%;left:10%">
			<div class="wap-qrcode-container">
				<p class="example1">{{pagedata.pluginset.title || '欢迎浏览'}}</p>
					<div class="wap-qrcode-image">
						<img ng-src="{{tomedia(pagedata.pluginset.ewm) || '../core/resource/images/nopic.jpg'}}"/>
					</div>
				<p class="example1">长按二维码关注</p>
			</div>
		</div>
	</div>
    <!--<div class="fui-header">
        <div class="fui-header-left">
            <!--<a class="back"></a>-->
        <!--</div>
		<div class="title">
			<div class="fui-searchbar bar">
				<div ng-class="{'searchbar center':1,'searchbar-active':pagedata.searchbar ==1}">
							<input type="button" ng-click="pagedata.getlist(1);"  value="搜索" class="searchbar-cancel searchbtn">
							<div class="search-input" ng-click="pagedata.searchbar =1">
								<input type="search" placeholder="搜索您感兴趣的内容..." class="search" ng-model="pagedata.params.keyword">
							</div>
				</div>
			</div>
		</div>
        <div class="fui-header-right"></div>
    </div>-->
    <div class="fui-content navbar" style="padding-bottom:2rem">
		<div id="carousel-container" class="carousel slide" data-role="carousel" data-param-auto="true">
			<div class="carousel-inner" role="listbox" style="height:6rem">
				<div ng-class="{'item':1,'active':$index==0}" ng-repeat="item in pagedata.banner">
					<a href="{{item.url}}">
						<img src="{{tomedia(item.picurl) || '../core/resource/images/banner-1.jpg'}}" style="display: block; width: 100%; height: 100%;">
					</a>
				</div>
			</div>
			<style>
				.fui-swipe-page .fui-swipe-bullet {background: {background}; opacity: {opacity};}
				.fui-swipe-page .fui-swipe-bullet.active {opacity: 1;}
			</style>
			<div id="carousel-jinyun" class="fui-swipe-page" style="padding: 0 5px; bottom: 10px; ">
				<div class="fui-swipe-bullet" ng-repeat="item in pagedata.banner" ng-class="{'active':$index==0}" data-target="#carousel-container" data-slide-to="{{$index}}"></div>
			</div>
		</div>
		<div class="section">
			<div style="height:30px;line-height:30px;">
				<div href="javascript:;" ng-click="access_json('jy_bdd/book/main/id='+pagedata.first.id)"  class="l-f">
					<span class="icon jinyunicon icon-shijian"></span>
					<span style="font-size:0.7rem">约课</span>
				</div>
				<div href="javascript:;" ng-click="access_json('jy_bdd/lesson_list/getlist/')" class="r-f">
					<span class="icon jinyunicon icon-zixingche"></span>
					<span style="font-size:0.7rem">课程</span>
				</div>
			</div>
			<div style="height:30px;line-height:30px;">
				<div href="javascript:;" ng-click="access_json('jy_bdd/home/')" class="c">
					<span class="icon jinyunicon icon-erweima"></span>
					<span style="font-size:0.7rem">入场码</span>
				</div>
			</div>
			<div style="height:30px;line-height:30px;">
				<div href="javascript:;" ng-click="access_json('jy_weishop/index/')" class="l-f">
					<span class="icon jinyunicon icon-gouwurili"></span>
					<span style="font-size:0.7rem">商城</span>
				</div>
				<div href="javascript:;" ng-click="access_json('jy_bdd/lesson_list/getlist/si=1')" class="r-f">
					<span class="icon jinyunicon icon-dingdan"></span>
					<span style="font-size:0.7rem">私教</span>
				</div>
			</div>
		</div>
		<div class="fui-cell-group fui-comment-group">
            <div class="fui-cell fui-cell-click">
                <div class="fui-cell-text desc">热门课程</div>
                <div class="fui-cell-text desc label" href="javascript:;" ng-click="access_json('jy_bdd/lesson_list/')" style="text-align: right;">
                    全部
                </div>
                <div class="fui-cell-remark"></div>
            </div>
            <div ng-if="pagedata.list.length>0" class="fui-list live-category-list">
                <div class="fui-list-inner">
                    <div class="live-category-list-inner">
                        <a ng-repeat="item in pagedata.list" href="javascript:;" ng-click="access_json('jy_bdd/lesson_detail//id='+item.id)" class="external">
                            <p style="width:4.5rem;"><img ng-src="{{tomedia(item.image) || '../core/resource/images/banner-1.jpg'}}"></p>
                            <span>{{item.title}}</span>
                        </a>
						<div ng-if="pagedata.groups.length <1" class='content-empty'>
							没有热门课程！
						</div>
                    </div>
                </div>
            </div>
        </div>
		<div ng-if="pagedata.notices.length>0" class="fui-notice">
			<div class="image"><img src="../core/resource/images/diy/hotdot.jpg"></div>
			<div class="icon"><i class="fa fa-volume-up" style="font-size: 0.7rem;"></i></div>
			<div class="text">
				<ul>
					<li ng-repeat="item in pagedata.notices">
						<a href="javascript:;" ng-click="access_json('core/article.list/detail/id='+item.id)">{{item.title}}</a>
					</li>
				</ul>
			</div>
		</div>
		<div ng-if="pagedata.notices.length>0" class="fui-goods-group block border">
			<div ng-repeat="item in pagedata.notices" class="fui-goods-item">
				<a ng-click="access_json('core/article.list/detail/id='+item.id)" >
					<div class="image" style="background-image: url('{{tomedia(item.pic_url) ||'../core/resource/images/nopic.jpg'}}')">
						<div ng-show="item.total <=0" class="salez" style="background-image: url('{{tomedia(pagedata.shopset.shop.saleout)}}'); "></div>
					</div>
				</a>
				<div class="detail">
					<a href="javascript:;" ng-click="access_json(item.active.url || 'core/article.list/detail/id='+item.id)">
						<div class="name">
							{{item.title}}
						</div>
					</a>
				</div>
			</div>
		</div>
		<script type="text/javascript">
			function autoScroll(obj){
				$(obj).find("ul").animate({  
					marginTop : "-1rem"  
				},800,function(){  
					$(this).css({marginTop : "0px"}).find("li:first").appendTo(this);  
				})  
			}  
			$(function(){  
				setInterval('autoScroll(".fui-notice .text")',3000);
			}) 
		</script>
		<div class="live-list">
            <div class="fui-list" ng-repeat="item in pagedata.store">
                <div class="fui-list-media">
                    <a ng-click="access_json('jy_bdd/r_detail/main/id='+item.id)"  data-nocache="true">
                        <span class="live-living">
                                <i></i>进行中
                         </span>
						<div class="pics">{{item.onum || 0}}课程</div>
                        <img ng-src="{{tomedia(item.thumb) || '../core/resource/images/banner-1.jpg'}}" alt="{{item.title}}">
                    </a>
                </div>
                <div class="fui-list-inner">
                    <a ng-click="access_json('jy_bdd/r_detail/main/id='+item.id)" data-nocache="true">
                        <h3>{{item.title}}</h3>
                    </a>
					<span class="overflow-h" style="font-size:0.65rem">{{item.infomsg}}</span>
                    <p>{{item.starttime}} 开</p>
                    <div class="live-list-subscribe">
                        <span>会员数 {{item.onum}}</span>
						<span>
                            <a  ng-click="access_json('jy_bdd/store_detail/main/id='+item.id)" class="live-subscribe-a live-subscribe-full-a">进入门店</a>
                        </span>
                    </div>
                </div>
            </div>
        </div>
		<div ng-if="pagedata.reply.length <1" class='content-empty'>
            没有门店！
        </div>
		<div ng-if="loading" class='infinite-loading'><span class='fui-preloader'></span><span style="margin-left:1.5rem"> 正在加载...</span></div>
	</div>
</div>
<div ng-include="sys_html('_footer')"></div>
<script>
var browserRule = /^.*((iPhone)|(iPad)|(Safari))+.*$/;
    if (browserRule.test(navigator.userAgent)) {
        window.onpageshow = function(event) {
            if (event.persisted) {
                window.location.reload()
            }
        };
    }
require(['bootstrap', 'hammer'], function($, Hammer){
		$('#carousel-container').carousel();
		var mc = new Hammer($('#carousel-container').get(0));
		mc.on("panleft", function(ev) {
			$('#carousel-container').carousel('next');
		});
		mc.on("panright", function(ev) {
			$('#carousel-container').carousel('prev');
		});
});
//信息弹窗：
//前端先注册以等待接收消息
require(['jinyun_socket'],function(jinyun_socket){
    jinyun_socket.connect();
    jinyun_socket.onsystem=function(res){
        if(res.message){
			var success_title = '确认';
			if(res.url){
				success_title = '前往查看';
			}
			scope.confirm({
						'message':res.message,
						'success':res.url,
						'success_title':success_title
			});
		}
    }
});
/*function checksms() {
	var params = {
					'plugin':'jy_bdd',
					'action':'upplan',
					'op':'checksms',
					'callback':function(res){
							if(res.msg){
								var success_title = '确认';
								if(res.url){
									success_title = '前往查看';
								}
								scope.confirm({
									'message':res.msg,
									'success':res.url,
									'success_title':success_title
								});
							}else{
								console.log('error');
							};
					}
			}
	scope.post_json(params);
}*/
scope.loading = true;  //状态标记
scope.isnodata = false;
scope.pagedata.list =[];
//滚动加载
scope.pagedata.params.keyword = ''
var page = 1;
scope.pagedata.getlist=function(type){
		if(type=='1'){
			page = 1;
			scope.pagedata.list =[];
		}else{
			
		}
		scope.get('jy_bdd/index/getlist/page='+page+'&keyword='+scope.pagedata.params.keyword,
				function(data){			
				if(data.error !=1){
								for (var i=0;i<data.list.length;i++){
									scope.pagedata.list.push(data.list[i]);
								}
								if(page >1){
									$("#listitem").animate({scrollTop:0},300);
								}
								if(data.list.length<1){
									scope.isnodata=true;
								}
								page++;
								scope.loading = false;
								scope.$evalAsync();
							}else{
								console.log('error!');
							};
			});
}
scope.pagedata.getlist(1);

scope.pagedata.getall=function(type){
		if(type=='1'){
			page = 1;
			scope.pagedata.notices =[];
		}else{
			
		}
		scope.get('jy_bdd/index/getall/page='+page,
				function(data){			
				if(data.error !=1){
								for (var i=0;i<data.notices.length;i++){
									scope.pagedata.notices.push(data.notices[i]);
								}
								if(page >1){
									$("#listitem").animate({scrollTop:0},300);
								}
								if(data.notices.length<1){
									scope.isnodata=true;
								}
								page++;
								scope.loading = false;
								scope.$evalAsync();
							}else{
								console.log('error!');
							};
			});
}
scope.pagedata.getall(1);
scope.pagedata.scroll_bottom=function(){
	if(!scope.isnodata && !scope.loading){
		scope.pagedata.getlist();
	}
}
</script>